 const fmtBankCode = function (bankCode) {
     if (typeof bankCode != "undefined") {
        var mccname = {
            ICBC: "工商银行",
            ABC: "农业银行",
            BOC: "中国银行",
            CCB: "建设银行",
            CMBCHINA: "招商银行",
            POST: "邮政储蓄",
            ECITIC: "中信银行",
            CEB: "光大银行",
            BOCO: "交通银行",
            CIB: "兴业银行",
            CMBC: "民生银行",
            PINGAN: "平安银行",
            CGB: "广发银行",
            HXB: "华夏银行",
            SPDB: "浦发银行",
            SHB: "上海银行",
            CBHB: "渤海银行",
            JSB: "江苏银行",
            BCCB:"北京银行",
            //后来加的小银行
            CZB:"浙商银行",
            SZNCSY:"深圳农村商业银行",
            jlb:"吉林银行",
            NingboB:"宁波银行",
            QLCB:"齐鲁银行股份有限公司",
            jyb:"江阴市农村商业银行",
            GZCB:"广州银行股份有限公司",
            shengjingb:"盛京银行",
            bankofdl:"大连银行",
            hebb:"河北银行股份优先公司",
            hzbank:"杭州市商业银行",
            njcb:"南京银行",
            uccb:"乌鲁木齐银行",
            bocd:"成都市商业银行",
            zzb:"郑州银行",
            gznxb:"贵州省农村信用联合社",
            bankofnx:"宁夏银行",
            hsb:"徽商银行",
            hrbrcb:"哈尔滨商行",
            hrb:"哈尔滨银行",
            // GCNCXYS:"广西壮族自治区农村信用合作社",
            GXRCU:'广西壮族自治区农村信用社',
            gyb:"贵阳银行股份有限公司",
            AHNCXY:"安徽省农村信用社联合",
            JXYH:"江西银行",
            jshb:"晋商银行",
            jiujiangb:"九江银行",
            tzb:"台州银行",
            bcs:"长沙银行股份有限公司",
            bsb:"包商银行",
            WZCB:"温州银行",
            hankou:"汉口银行",
            cqrcb:"重庆农村商业银行",
            fjnx:"福建省农村信用联合社",
            MINTAIBK:"浙江民泰商业银行",
            whrcb:"武汉农村商业银行",
            zybk:"中原银行",

        };
       //  console.log(bankCode)
       //  console.log(mccname[bankCode])  undefined
        return mccname[bankCode];
     }
 }
 const fmtCardNo = function (cardNo) {
     return (cardNo + "").slice((cardNo + "").length - 4);
 };
 const fmtAmount= function (amount) {
     if(amount){
        return (amount / 100).toFixed(2);
     }else{
         return 0;
     }
   
}
const FixedNum2= function (amount) {
    if(amount){
        return  amount.toFixed(2)
    }
}



const fmtBankimsrc= function (imgsrc) {
     if(imgsrc){
            imgsrc=imgsrc.toUpperCase()
            if(imgsrc != 'ICBC' && imgsrc != 'ABC' && imgsrc != 'BOC' && imgsrc != 'CCB' && imgsrc != 'CMBCHINA' && imgsrc != 'POST' && imgsrc != 'ECITIC' && imgsrc != 'CEB' 
            && imgsrc != 'BOCO' &&  imgsrc != 'CIB' && imgsrc != 'CMBC' && imgsrc != 'PINGAN' && imgsrc != 'CGB' && imgsrc != 'HXB' && imgsrc != 'SPDB' && imgsrc != 'SHB' &&
            imgsrc != 'CBHB' && imgsrc != 'JSB' && imgsrc != 'BCCB' ){
                imgsrc = 'other'
            }
           
            return 'http://hstatic.1818pay.cn/image/banklogo/62*62/' + imgsrc + ".png";
     }else{
        return ''
     }  
   
}

  const fmthkdate= function (riqi) {

        console.log("riqi",riqi)
        var myDate = new Date().getDate();
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var d = new Date(year, month, 0);
        var s = d.getDate();
        console.log('本月'+s)
        console.log('今天'+myDate)
        if (parseInt(riqi.statementDate) < parseInt(riqi.repaymentDate)) {

            if(riqi.statementDate<myDate&&riqi.repaymentDate>myDate){ //当前日期 再 还款日与当前日期之前
                var datt = parseInt(riqi.repaymentDate) - parseInt(myDate)
            }else{
                var datt = parseInt(riqi.repaymentDate) - parseInt(riqi.statementDate)
            }
            return datt
         
        } else if(parseInt(riqi.statementDate) > parseInt(riqi.repaymentDate)){

            if(riqi.statementDate > myDate && riqi.repaymentDate > myDate) {
                return riqi.repaymentDate * 1 - myDate;
            } else {
                return s * 1 - riqi.statementDate * 1 + riqi.repaymentDate * 1
            }



        }
    }
    const fmtjdt= function (jdt) {
       if(jdt){
         return jdt.toFixed(2);
       }else{
           return 0
       }
        
    }

 export {
     fmtBankCode,
     fmtCardNo,
     fmtAmount,
     fmtBankimsrc,
     fmthkdate,
     fmtjdt,
     FixedNum2
 }